package bulider

import basedemo.Car
import groovy.json.JsonBuilder

def car = new Car(50000, 2019)
def builder = new JsonBuilder(car) ///生成器,可从对象,map,列表生成json
def writer = new StringWriter()
/*builder {   //自定义
    color "red"
    speed "5000m/h"
}*/
builder.writeTo(writer)
println writer